package com.cupk.controller;

import com.cupk.pojo.Result;
import com.cupk.service.GradeService;
import com.cupk.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/visual")
public class VisualController {
    @Autowired
    private RecordService recordService;
    @Autowired
    private GradeService gradeService;

    @GetMapping("/regStatus")
    public Result<List<Map<String, Object>>> regStatus(@RequestParam Integer matchId) {
        List<Map<String, Object>> res = recordService.divideMinute(matchId);
        return Result.success(res);
    }

    @GetMapping("/divideGroupByMajorAndGrade")
    public Result<List<Map<String, Object>>> divideGroupAndGrade(@RequestParam Integer matchId) {
        List<Map<String, Object>> res = recordService.divideGroupByMajorAndGrade(matchId);
        return Result.success(res);
    }

    @GetMapping("/divideGroupByGrade")
    public Result<List<Map<String, Object>>> divideGroupByGrade(@RequestParam Integer matchId) {
        List<Map<String, Object>> res = recordService.divideGroupByGrade(matchId);
        return Result.success(res);
    }

    @GetMapping("/awardLevelClassification")
    public Result<List<Map<String, Object>>> awardLevelClassification(@RequestParam Integer matchId) {
        List<Map<String, Object>> res = gradeService.awardLevelClassification(matchId);
        return Result.success(res);
    }
}
